﻿using System;
using System.Data;
using System.Collections.Generic;
using Chenxin.Lib.Business.Entity;
namespace Chenxin.Lib.Business.BLL
{
    /// <summary>
    /// 业务逻辑类t_Intention_CreateInfo 的摘要说明。
    /// </summary>
    public class t_Intention_CreateInfo
    {
        public t_Intention_CreateInfo()
        { }
        #region  成员方法
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Chenxin.Lib.Business.Entity.t_Intention_CreateInfo model)
        {
            Chenxin.Lib.Business.DAL.t_Intention_CreateInfo.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Chenxin.Lib.Business.Entity.t_Intention_CreateInfo model)
        {
            Chenxin.Lib.Business.DAL.t_Intention_CreateInfo.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(Guid RecordId)
        {

            Chenxin.Lib.Business.DAL.t_Intention_CreateInfo.Delete(RecordId);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Chenxin.Lib.Business.Entity.t_Intention_CreateInfo GetModel(Guid RecordId)
        {

            return Chenxin.Lib.Business.DAL.t_Intention_CreateInfo.GetModel(RecordId);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return Chenxin.Lib.Business.DAL.t_Intention_CreateInfo.GetList(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.t_Intention_CreateInfo> GetModelList(string strWhere)
        {
            DataSet ds = Chenxin.Lib.Business.DAL.t_Intention_CreateInfo.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.t_Intention_CreateInfo> DataTableToList(DataTable dt)
        {
            List<Chenxin.Lib.Business.Entity.t_Intention_CreateInfo> modelList = new List<Chenxin.Lib.Business.Entity.t_Intention_CreateInfo>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Chenxin.Lib.Business.Entity.t_Intention_CreateInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Chenxin.Lib.Business.Entity.t_Intention_CreateInfo();
                    if (dt.Rows[n]["RecordId"].ToString() != "")
                    {
                        model.RecordId = new Guid(dt.Rows[n]["RecordId"].ToString());
                    }
                    if (dt.Rows[n]["CreateDate"].ToString() != "")
                    {
                        model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString());
                    }
                    if (dt.Rows[n]["CreateEmpId"].ToString() != "")
                    {
                        model.CreateEmpId = new Guid(dt.Rows[n]["CreateEmpId"].ToString());
                    }
                    model.CreateEmp = dt.Rows[n]["CreateEmp"].ToString();
                    if (dt.Rows[n]["BelongCityId"].ToString() != "")
                    {
                        model.BelongCityId = new Guid(dt.Rows[n]["BelongCityId"].ToString());
                    }
                    model.BelongCityName = dt.Rows[n]["BelongCityName"].ToString();
                    if (dt.Rows[n]["BelongCompanyId"].ToString() != "")
                    {
                        model.BelongCompanyId = new Guid(dt.Rows[n]["BelongCompanyId"].ToString());
                    }
                    model.BelongCompany = dt.Rows[n]["BelongCompany"].ToString();
                    if (dt.Rows[n]["BelongDepartId"].ToString() != "")
                    {
                        model.BelongDepartId = new Guid(dt.Rows[n]["BelongDepartId"].ToString());
                    }
                    model.BelongDepart = dt.Rows[n]["BelongDepart"].ToString();
                    if (dt.Rows[n]["BelongEmpId"].ToString() != "")
                    {
                        model.BelongEmpId = new Guid(dt.Rows[n]["BelongEmpId"].ToString());
                    }
                    model.BelongEmp = dt.Rows[n]["BelongEmp"].ToString();
                    if (dt.Rows[n]["StartCode"].ToString() != "")
                    {
                        model.StartCode = int.Parse(dt.Rows[n]["StartCode"].ToString());
                    }
                    if (dt.Rows[n]["CodeCount"].ToString() != "")
                    {
                        model.CodeCount = int.Parse(dt.Rows[n]["CodeCount"].ToString());
                    }
                    if (dt.Rows[n]["IntentionType"].ToString() != "")
                    {
                        model.IntentionType = int.Parse(dt.Rows[n]["IntentionType"].ToString());
                    }
                    if (dt.Rows[n]["BusinessType"].ToString() != "")
                    {
                        model.BusinessType = int.Parse(dt.Rows[n]["BusinessType"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return Chenxin.Lib.Business.DAL.t_Intention_CreateInfo.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}
